
<?php
/**
  * Musashi - A project manager for music groups and bands
  * Copyright (C) 2010 Daniel Torres
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */

/**
 * Displays a listing of equipment types, with default information
 *  
 * @package Musashi
 * @author Daniel Torres
 */
 
 // Make sure we have access to this page
 defined('_JEXEC') or die ('Restricted access. Sorry');
 
    // Count the number of results
    $rowCount = count($this->dataRows);
    if($rowCount == 0)
    {
       ?>
       <h1>No records yet. Click New to start!</h1>
       <?php
    }
    else
    {
       ?>
        <form action="index.php" method="post" name="adminForm">
        <div id="editcell">
            <table class="adminlist">
            <thead>
                <tr>
                    <th width="20">
                        <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo $rowCount; ?>);" />
                    </th>
                    <th width="60">
                        Name
                    </th>
                    <th>
                        Description
                    </th>
                </tr>
           </thead>
           <?php
            $k = 0;
            for( $i = 0; $i < $rowCount; $i++ )
            {
                $row =& $this->dataRows[$i];
                $checked = JHTML::_('grid.id', $i, $row->id );
                $link = JRoute::_('index.php?option=com_musashi&controller=catalog&task=edit&sectn='.$this->viewName.'&cid[]='.$row->id);
                ?>
                <tr class="<?php echo "row$k"; ?>">
                    <td>
                        <?php echo $checked; ?>
                    </td>
                    <td>
                        <a href="<?php echo $link; ?>"><?php echo $row->name; ?></a>
                    </td>
                    <td>
                        <?php echo $row->description; ?>
                    </td>
                </tr>
                <?php
                $k = 1 - $k;
            }        
           ?>
        </table>
        </div>
           
           <?php // These must always be here ?>
            <input type="hidden" name="option" value="com_musashi" />
            <input type="hidden" name="task" value="" />
            <input type="hidden" name="boxchecked" value="0" />
            <input type="hidden" name="controller" value="catalog" />
            <input type="hidden" name="sectn" value="<?php echo $this->viewName; ?>" />
        </form>
       <?php
    }
?>